Skip to content

test(web): add unit tests for isDeploymentRunning utility - #7145

Merged
khanhtc1202 merged 3 commits into
pipe-cd:masterfrom
vikash7485:test/add-coverage-for-is-deployment-running
Aug 22, 2026
Merged

test(web): add unit tests for isDeploymentRunning utility#7145
khanhtc1202 merged 3 commits into
pipe-cd:masterfrom
vikash7485:test/add-coverage-for-is-deployment-running

Conversation

@vikash7485

@vikash7485 vikash7485 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

Add unit tests for isDeploymentRunning in web/src/utils/is-deployment-running.ts, covering all 7 DeploymentStatus enum values and the undefined edge case.

Why we need it:

This utility has zero test coverage despite being a critical decision function called in:

  • DeploymentDetailPage (controls polling interval)
    • DeploymentDetail (controls cancel button visibility)
    • Pipeline component (determines if stages are interactive)
      Without tests, future enum additions to DeploymentStatus could silently break polling behavior with no regression signal.

Which issue(s) this PR fixes:

Fixes #
Does this PR introduce a user-facing change?:

No. This PR only adds test coverage for an existing utility function.

  • How are users affected by this change: No user-facing impact.
    • Is this breaking change: No.
    • How to migrate (if breaking change): N/A.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi @vikash7485, welcome to PipeCD and thanks for opening your first pull request!

We’re really happy to have you here

Before your PR gets merged, please check a few important things below.


Helpful resources


DCO Sign-off

All commits must include a Signed-off-by line to comply with the Developer Certificate of Origin (DCO).

In case you forget to sign-off your commit(s), follow these steps:

For the last commit:

git commit --amend --signoff
git push --force-with-lease

For multiple commits:

git rebase --signoff origin/master
git push --force-with-lease

Run checks locally

Before pushing updates, please run:

make check

This runs the same checks as CI and helps catch issues early.


💬 Need help?

If anything is unclear, feel free to ask in this PR or join us on the CNCF Slack in the #pipecd channel.
You can get your Slack invite from: https://communityinviter.com/apps/cloud-native/cncf

Thanks for contributing to PipeCD! ❤️

@vikash7485
vikash7485 force-pushed the test/add-coverage-for-is-deployment-running branch 2 times, most recently from 2ffa638 to f5ccc5b Compare August 11, 2026 04:02

@rahulshendre rahulshendre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 7 cases could fold into one it.each table, we can trim the repetition.
Also Fixes #6915 is not really correct - that's the Snyk alpine upgrade PR, please fix it.

Add unit tests for all 7 DeploymentStatus enum variants
(PENDING, PLANNED, RUNNING, ROLLING_BACK, SUCCESS, FAILURE,
CANCELLED) plus the undefined edge case.

This brings the utility from 0% to 100% branch coverage.

Related: pipe-cd#6706
Signed-off-by: vikash7485 <vikkiraj073@gmail.com>
@vikash7485
vikash7485 force-pushed the test/add-coverage-for-is-deployment-running branch from 164b755 to f7e3959 Compare August 21, 2026 09:48
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for pipecd-site ready!

Name Link
🔨 Latest commit a92d012
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6a897828bdbf1a000892f66b
😎 Deploy Preview https://deploy-preview-7145--pipecd-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.77%. Comparing base (9e89f95) to head (a92d012).

❗ There is a different number of reports uploaded between BASE (9e89f95) and HEAD (a92d012). Click for more details.

HEAD has 10 uploads less than BASE
Flag BASE (9e89f95) HEAD (a92d012)
.-tool-actions-plan-preview 1 0
.-tool-codegen-protoc-gen-auth 1 0
.-pkg-app-pipedv1-plugin-waitapproval 1 0
.-tool-actions-gh-release 1 0
.-pkg-app-pipedv1-plugin-terraform 1 0
.-pkg-app-pipedv1-plugin-scriptrun 1 0
.-pkg-app-pipedv1-plugin-analysis 1 0
.-pkg-app-pipedv1-plugin-ecs 1 0
.-pkg-app-pipedv1-plugin-wait 1 0
.-pkg-plugin-sdk 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7145       +/-   ##
===========================================
- Coverage   47.06%   28.77%   -18.30%     
===========================================
  Files         172      501      +329     
  Lines       16719    55860    +39141     
===========================================
+ Hits         7869    16071     +8202     
- Misses       8288    38465    +30177     
- Partials      562     1324      +762     
Flag Coverage Δ
. 23.57% <ø> (?)
.-pkg-app-pipedv1-plugin-analysis ?
.-pkg-app-pipedv1-plugin-ecs ?
.-pkg-app-pipedv1-plugin-kubernetes 58.39% <ø> (ø)
.-pkg-app-pipedv1-plugin-kubernetes_multicluster 59.62% <ø> (ø)
.-pkg-app-pipedv1-plugin-scriptrun ?
.-pkg-app-pipedv1-plugin-terraform ?
.-pkg-app-pipedv1-plugin-wait ?
.-pkg-app-pipedv1-plugin-waitapproval ?
.-pkg-plugin-sdk ?
.-tool-actions-gh-release ?
.-tool-actions-plan-preview ?
.-tool-codegen-protoc-gen-auth ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@khanhtc1202
khanhtc1202 merged commit 359d508 into pipe-cd:master Aug 22, 2026
65 of 66 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for contributing to PipeCD, @vikash7485! The changes in this pull request will be part of the upcoming release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants